<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>修改密码</title>
  <style>
    .container {
      max-width: 400px;
      margin: auto;
      padding: 20px;
      background-color: #f4f4f4;
      border-radius: 5px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    }

    h1 {
      text-align: center;
    }

    form {
      display: flex;
      flex-direction: column;
    }

    label, input, button {
      margin-bottom: 10px;
    }

    .error {
      color: red;
    }

    .success {
      color: green;
    }


    /* 添加样式以将返回链接定位在右上角 */
    .back-link {
      position: absolute;
      top: 10px;
      right: 10px;
      text-decoration: none;
      color: #007bff; /* 链接颜色 */
      font-weight: bold;
    }

    .back-link:hover {
      text-decoration: underline;
    }

  </style>
</head>
<body>
<div class="container">

  <a th:href="@{/toAdminPage}" class="back-link">返回</a>

  <h1>修改密码</h1>

  <p th:if="${param.error}" class="error">原密码不正确。</p>
  <p th:if="${param.success}" class="success">密码已成功修改。</p>

  <form th:action="@{/updateAdminPassword}" method="post">
    <label for="oldPassword">原密码:</label>
    <input type="password" id="oldPassword" name="oldPassword" required />

    <label for="newPassword">新密码:</label>
    <input type="password" id="newPassword" name="newPassword" required />

    <button type="submit">修改密码</button>
  </form>
</div>
</body>
</html>